import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;

public class LiczbaTestJU4 {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testKonstruktorDomyslny() throws Exception
	{
		Liczba l = new Liczba();
		for(int i=2; i<=17; i++) {
			assertNotNull(l.zapis(i));
		}
	}
	
	@Test(expected=LiczbaException.class)
	public void testZaMalaPodstawa() throws Exception {
		new Liczba("10", 1);
		
	}
	
	@Test(expected=LiczbaException.class)
	public void testZaDuzaPodstawa() throws Exception {
		new Liczba("10", 18);
		fail("Oczekiwany LiczbaException");
	}
	
	@Test(expected=LiczbaException.class)
	public void testPodstawaWZapisieZaMala() throws Exception {
		new Liczba("10", 1).zapis(1);
		fail("Oczekiwany LiczbaException");
	}

	@Test(expected=LiczbaException.class)
	public void testPodstawaWZapisieZaDuza() throws Exception {
		new Liczba("10", 18).zapis(1);
		fail("Oczekiwany LiczbaException");
	}
	
	@Test(timeout=500)
	public void powolnyTest() throws Exception
	{
		String[] in = {"27", "36", "72"};
		String[][] out = {
				{"11011", "1000", "123", "102", "43", "36", "33", "30", "27", "25", "23", "21", "1D", "1C", "1B", "1A"},
				{"100100", "1100", "210", "121", "100", "51", "44", "40", "36", "33", "30", "2A", "28", "26", "24", "22"}, 
				{"1001000", "2200", "1020", "242", "200", "132", "110", "80", "72", "66", "60", "57", "52", "4C", "48", "44"}
		};
		for(int i=0; i<in.length; i++) {
			Liczba l = new Liczba(in[i], 10);
			for(int k = 0; k<out.length; k++) {
				assertEquals(l.zapis(k+2),out[i][k]);
			}
			
		}

	}

	@Ignore
	public void noneTest() {
		//nothing
	}
	
	@After
	public void tearDown() throws Exception {
	}


}